﻿using PlaceOrder_Client.Views;
using Prism.Common;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;

namespace PlaceOrder_Client.ViewModels
{
    public partial class LoadingDialogViewModel : BindableBase
    {
        private string title = "请稍等";

        public string Title
        {
            get { return title; }
            set { title = value; RaisePropertyChanged(); }
        }


        public bool IsClick { get; set; }

        private LoadingDialogView loadingDialogView;
        public LoadingDialogView LoadingDialogView
        {
            get => loadingDialogView;
            set
            {
                loadingDialogView = value;
                loadingDialogView.MouseLeftButtonDown += (sender, e) =>
                {
                    IsClick = true;
                };
                loadingDialogView.MouseLeftButtonUp += (sender, e) =>
                {
                    IsClick = false;
                };
                loadingDialogView.MouseLeave += (sender, e) =>
                {
                    IsClick = false;
                };

                loadingDialogView.closeBtn.Click += CloseBtn_Click;
            }
        }

        private void CloseBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            IsClick = true;
        }

        public LoadingDialogViewModel()
        {
        
        }

        //public void ExecuteOnUiThread(UiThreadAction action)
        //{
        //    _dispatcher.Invoke(action);
        //}
    }
}
